package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId    int    `gorm:"type:int(11);not null;index:ip_idx"`
	Total     int    `gorm:"type:int(11);not null;"`
	Numbering string `gorm:"type:varchar(40);not null;"`
}

type OrderGood struct {
	gorm.Model
	OrderId int    `gorm:"type:int(11);not null;index:ip_idx"`
	Price   int    `gorm:"type:int(11);not null;index:ip_idx"`
	Title   string `gorm:"type:varchar(40);not null;"`
}

func (o *Order) OrderCreate() error {
	return DB.Debug().Model(&o).Create(&o).Error
}
func (og *OrderGood) OrderGoodCreate() error {
	return DB.Debug().Model(&og).Create(&og).Error
}
